# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=kamilalisp
pkgver=0.3.0.1
pkgrel=2
pkgdesc="Functional, flexible and concise Lisp"
url="https://github.com/kspalaiologos/kamilalisp"
_jdkver=17
# jdk17, don't care about 32-bit
arch="aarch64 x86_64"
license="MIT AND Apache-2.0 AND GPL-3.0-or-later"
depends="openjdk$_jdkver-jre"
makedepends="maven openjdk$_jdkver-jdk"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/kspalaiologos/kamilalisp/archive/refs/tags/v$pkgver.tar.gz"
options="net" # maven

build() {
	JAVA_HOME="/usr/lib/jvm/java-$_jdkver-openjdk" \
	mvn -B package -Dmaven.test.skip=true --file pom.xml
}

check() {
	mvn test
}

package() {
	install -Dm755 /dev/stdin "$pkgdir"/usr/bin/kamilalisp <<-EOF
	#!/bin/sh
	exec /usr/lib/jvm/java-$_jdkver-openjdk/bin/java -jar /usr/share/kamilalisp/kamilalisp.jar "\$@"
	EOF

	install -Dm644 target/kamilalisp-0.3.jar -t "$pkgdir"/usr/share/kamilalisp/
	ln -sfv kamilalisp-0.3.jar "$pkgdir"/usr/share/kamilalisp/kamilalisp.jar

	install -Dm644 doc/main.pdf "$pkgdir"/usr/share/doc/$pkgname/kamilalisp-book.pdf
}

sha512sums="
80c9158cfe3469536ca54f8af128ee6b42db63a4e193dc20e4cb6743f594c783b0a9f552dd5ef3ed6695d780669c04c55675a95c250f6213eb46b639797d96ae  kamilalisp-0.3.0.1.tar.gz
"
